home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / Asm / Fading / WhiteFade.s < prev    next >
Encoding:
Text File  |  1998-08-03  |  3.4 KB  |  135 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;Fades the screen to white, then down to a palette, and exits with a fade
  3. ;to black.  This demo can load and fade any picture that you specify at
  4. ;the end of this file.
  5. ;
  6. ;Press left mouse button to exit.
  7.  
  8.     INCDIR    "INCLUDES:"
  9.     INCLUDE    "dpkernel/dpkernel.i"
  10.  
  11.     SECTION    "Demo",CODE
  12.  
  13. ;===========================================================================;
  14. ;                             INITIALISE DEMO
  15. ;===========================================================================;
  16.  
  17.     STARTDPK
  18.  
  19. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  20.     move.l    DPKBase(pc),a6
  21.     lea    FilePic(pc),a0
  22.     moveq    #ID_PICTURE,d0
  23.     CALL    Load
  24.     move.l    d0,Picture
  25.     beq.s    .Exit
  26.  
  27.     moveq    #ID_SCREEN,d0
  28.     CALL    Get
  29.     move.l    d0,Screen
  30.     beq.s    .Exit
  31.  
  32.     move.l    Picture(pc),a0
  33.     move.l    Screen(pc),a1
  34.     CALL    CopyStructure
  35.  
  36.     move.l    Screen(pc),a0
  37.     move.l    GS_Bitmap(a0),a1
  38.     move.l    #BMF_BLANKPALETTE,BMP_Flags(a1)
  39.     sub.l    a1,a1
  40.     CALL    Init
  41.     tst.l    d0
  42.     beq.s    .Exit
  43.  
  44.     move.l    Picture(pc),a0
  45.     move.l    PIC_Bitmap(a0),a0
  46.     move.l    Screen(pc),a1
  47.     move.l    GS_Bitmap(a1),a1
  48.     CALL    Copy
  49.  
  50.     move.l    Screen(pc),a0
  51.     CALL    Show
  52.  
  53.     bsr.s    Main
  54.  
  55. .Exit    move.l    DPKBase(pc),a6
  56.     move.l    Picture(pc),a0
  57.     CALL    Free
  58.     move.l    Screen(pc),a0
  59.     CALL    Free
  60.     MOVEM.L    (SP)+,A0-A6/D1-D7
  61.     moveq    #ERR_OK,d0
  62.     rts
  63.  
  64. ;===========================================================================;
  65. ;                                MAIN CODE
  66. ;===========================================================================;
  67.  
  68. Main:    move.l    SCRBase(pc),a6
  69.     move.l    Screen(pc),a0
  70.     move.l    GS_Bitmap(a0),a5
  71.     moveq    #$00,d7    ;d7 = FadeState (reset).
  72. .f_in    CALL    scrWaitAVBL
  73.  
  74.     moveq    #5,d1    ;d1 = Speed of fade.
  75.     move.l    Screen(pc),a0
  76.     moveq    #$000000,d2    ;d2 = Source colour
  77.     move.l    #$ffffff,d5    ;d5 = Destination colour.
  78.     moveq    #00,d3    ;d3 = Start colour
  79.     move.l    BMP_AmtColours(a5),d4    ;d4 = Amount of colours.
  80.     move.w    d7,d0    ;d0 = FadeState
  81.     CALL    scrColourMorph    ;Do the fade routine.
  82.     move.w    d0,d7    ;Has the fade finished yet?
  83.     bne.s    .f_in    ;If not, keep doing it.
  84.  
  85.     moveq    #$00,d7
  86. .f_mid    CALL    scrWaitAVBL
  87.     moveq    #2,d1    ;d1 = Speed of fade.
  88.     move.l    Screen(pc),a0
  89.     move.l    Picture(pc),a1
  90.     move.l    PIC_Bitmap(a1),a1
  91.     move.l    BMP_Palette(a1),a1    ;a1 = Palette to fade to.
  92.     addq.w    #8,a1
  93.     move.l    #$ffffff,d2    ;d2 = Colour we are fading from.
  94.     move.w    d7,d0
  95.     CALL    scrColourToPalette    ;Do the fade routine.
  96.     move.w    d0,d7    ;Has the fade finished yet?
  97.     bne.s    .f_mid    ;If not, keep doing it.
  98.  
  99.     moveq    #$00,d7
  100. .f_out    CALL    scrWaitAVBL
  101.     move.l    Screen(pc),a0
  102.     moveq    #2,d1    ;d0 = Speed of fade.
  103.     move.l    Picture(pc),a1
  104.     move.l    PIC_Bitmap(a1),a1
  105.     move.l    BMP_Palette(a1),a1    ;a1 = Palette to fade to.
  106.     addq.w    #8,a1
  107.     moveq    #$000000,d2    ;d2 = Destination colour.
  108.     move.w    d7,d0
  109.     CALL    scrPaletteToColour    ;Do the fade routine.
  110.     move.w    d0,d7    ;Has the fade finished yet?
  111.     bne.s    .f_out    ;If not, keep doing it.
  112.  
  113.     move.l    DPKBase(pc),a6
  114.     moveq    #20,d0
  115.     CALL    WaitTime
  116.     rts
  117.  
  118. ;===========================================================================;
  119. ;                                  DATA
  120. ;===========================================================================;
  121.  
  122. Screen:        dc.l  0
  123. Picture:    dc.l  0
  124. FilePic:    FILENAME "GMS:demos/data/PIC.Loading"
  125.  
  126. ;===========================================================================;
  127.  
  128. ProgName:    dc.b  "White Fade",0
  129. ProgAuthor:    dc.b  "Paul Manias",0
  130. ProgDate:    dc.b  "March 1998",0
  131. ProgCopyright:    dc.b  "DreamWorld Productions (c) 1996-1998.  Freely distributable.",0
  132. ProgShort:    dc.b  "Fading demonstration.",0
  133.         even
  134.  
  135.